<template>
  <div>
      <myhead></myhead>
      <van-row>
        <van-col span="3"> <navigation></navigation>  </van-col>
        <van-col span="3"> <tree @changepid="getpid"></tree> </van-col>
        <van-col span="18"> 
            
            <br>
            员工名称：<input type="text" v-model="text"> <van-button @click="like">查询</van-button>  <van-button @click="fun">重置</van-button>  <br>
             <br>
             <van-button>新增</van-button>  <van-button @click="download">导出</van-button>  
                  <van-uploader :after-read="uploader">
                    <van-uploader>
                        <van-button icon="plus" type="primary">导入文件</van-button>
                    </van-uploader>
                    </van-uploader>
             <br> <br>
             
            <table width="800px">
                <tr>
                    <td>账号</td>
                    <td>姓名</td>
                    <td>性别</td>
                    <td>手机号</td>
                    <td>邮箱</td>
                    <td>工号</td>
                    <td>操作</td>
                    
                </tr>
                <tr v-for="i in datas" :key="i.id">     
                  <td> {{i.id}} </td>
                  <td> {{i.name}} </td>
                  <td> {{i.gender}} </td>
                  <td> {{i.mobile}} </td>
                  <td> {{i.emit}} </td>
                  <td> {{i.coding}} </td>
                  <td>
                      <van-button>编辑</van-button>
                      <van-button>更多</van-button>
                  </td>
                </tr>
                
            </table>
            
        </van-col>
        
      </van-row>
      
  </div>
</template>

<script>
import Myhead from '../comm/myhead.vue'
import navigation from '../comm/left.vue'
import axios from 'axios'
import tree from '../tree.vue'

// import axios from '../http/axios'

export default {
    data(){
      return{
        datas:[],
        pid:'',
        text:'',
      }
    },
    components:{
        Myhead,
        navigation,
        tree,
    },
    methods:{
        getusers(){
            axios.get('/getusers?coding='+this.pid).then(res=>{
                console.log(res);
                this.datas = res.data.data
            })
        },
        like(){
            axios.get('/getusers?test='+this.text).then(res=>{
                console.log(res);
                this.datas = res.data.data
            })
        },
        
      uploader(file) {
        let formData = new FormData()
        formData.append('file', file.file)
        axios({method: 'post',url: '/upload', data: formData}).then(res => {
                console.log(res)
        })
    },
      download(){
        axios({mounted:'post',url:'download'}).then(res=>{
          console.log(res);
        })
      },
      getpid(id){
        this.pid = id
        // alert(id)
        this.getusers()
      },
      fun(){
         
         this.getusers()
     }
      

    },
    mounted(){
        // this.getusers()
    }
    
}
</script>

<style>

</style>


